<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
	<head>
		<base href="<%=basePath%>" />
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<meta name="apple-mobile-web-app-title" content="Amaze UI" />
		<link rel="stylesheet" href="layui/css/layui.css" media="all"> <!-- 适应所有设备 -->
		<style type="text/css">
		</style>
	</head>
	<% String nowDay = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); %>
	<body>
	    <form class="layui-form">
	      <div class="layui-form-item">
		      <label class="layui-form-label">游戏选择</label>
		      <div class="layui-input-inline">
		        <select name="DifficultSelect">
		          <option value="1,1">3D捕鱼</option>
		          <option value="1,4">集结号捕鱼</option>
		          <option value="3,0">拉霸机</option>
		          <option value="4,0">打地鼠</option>
		          <option value="7,0">龙虎斗</option>
		          <option value="9,0">性感女优</option>
		        </select>
		      </div>
		      <label class="layui-form-label">难度设置</label>
		      <div class="layui-input-inline">
		        <select name="DifficultSet">
		          <option value="0">地域灾难</option>
		          <option value="1">非常困难</option>
		          <option value="2">困难</option>
		          <option value="-1">取消控制</option>
		          <option value="3">中等</option>
		          <option value="4">简单</option>
		          <option value="5">分红</option>
		          <option value="6">大富豪</option>
		        </select>
		      </div>
		  </div>
	      <div class="layui-form-item">
            <div class="layui-input-block">
              <button class="layui-btn" lay-submit lay-filter="changeGameDifficult">立即提交</button>
              <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
	  </form>
	
	    <script src="js/jquery.min.js"></script>
		<script src="layui/layui.js"></script>
		<script>
		    layui.use(['layer','form'],function(){
		    	var layer = layui.layer,
		    	    form  = layui.form;
		    	
		    	//定义开关
		    	var upLockClicktag = 0;
		    	form.on('submit(changeGameDifficult)',function(data){
		    		if(upLockClicktag == 0){
		    			upLockClicktag = 1;
		    			$.ajax({
		    				type:'POST',
		    				url:'Room/SetGameDifficult',
		    				async:true,
		    				data:{
		    					DifficultSelect:data.field.DifficultSelect,
		    					DifficultSet:data.field.DifficultSet
		    				},
		    				success:function(resp){
		    					if(resp == "success"){
    							  layer.msg("设置成功",{icon:1});
		    					}else{
		    					  layer.msg(resp,{icon:2});
		    					}
		    				}
		    			});
		    		return false;
		    		setTimeout(function () { upLockClicktag = 0 }, 3000);
		    		}else{
		    			layer.msg("请勿频繁操作！！！",{icon:2});
		    		}
		    	});
		    });
		</script>
    </body>
</html>